package com.oriental.manage.service.reserve;

import com.oriental.manage.core.paging.Pagination;
import com.oriental.manage.core.response.ResponseDTO;
import com.oriental.reserve.api.report.BankReservePushInterface;
import com.oriental.reserve.model.ResponseModel;
import com.oriental.reserve.model.report.BankReportModelDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Author: Yang xp
 * Date: 2017/3/14
 * Time: 10:17
 * Desc：
 */
@Service
@Slf4j
public class BankReserveReportService {

    @Autowired
    private BankReservePushInterface bankReservePushInterface;

    public void searchBankReport(ResponseDTO<Pagination<BankReportModelDto>> responseDTO,BankReportModelDto bankReportModelDto){
        Pagination<BankReportModelDto>  pagination = new Pagination<>();
        log.info("查询银行信息请求信息:{}",bankReportModelDto);
        ResponseModel<List<BankReportModelDto>> responseModel = bankReservePushInterface.selectBankReport(bankReportModelDto);
        log.info("查询银行响应信息:{}",responseModel);
        pagination.setPageNum(bankReportModelDto.getPageNum());
        pagination.setPageSize(bankReportModelDto.getPageSize());
        ReserveUtil.responseQueryHandle(responseModel,pagination,responseDTO,bankReportModelDto,"查询失败");
    }

    public void auditBankReport(ResponseDTO<String> responseDTO,BankReportModelDto bankReportModelDto){
        log.info("审核银行报表:{}",bankReportModelDto);
        ResponseModel<BankReportModelDto> responseModel = bankReservePushInterface.auditBankReport(bankReportModelDto);
        log.info("审核银行报表响应信息:{}",responseModel);
        ReserveUtil.responseHandle(responseModel,responseDTO,"操作成功");
    }

    public void pullCheckResult(ResponseDTO<String> responseDTO,BankReportModelDto bankReportModelDto){
        log.info("获取勾稽信息:{}",bankReportModelDto);
        ResponseModel<BankReportModelDto> responseModel = bankReservePushInterface.pullReportCheckResult(bankReportModelDto);
        log.info("勾稽响应信息:{}",responseModel);
        ReserveUtil.responseHandle(responseModel,responseDTO,"操作成功");
    }

    public void bankReportPush(ResponseDTO<String> responseDTO,BankReportModelDto bankReportModelDto){
        log.info("构建银行报表信息:{}",bankReportModelDto);
        ResponseModel<String> responseModel = bankReservePushInterface.bankReportPush(bankReportModelDto);
        log.info("构建银行报表响应信息:{}",responseModel);
        ReserveUtil.responseHandle(responseModel,responseDTO,"操作成功");
    }

}
